<?php

namespace App\Providers;

use EasyWeChat\Factory;
use Illuminate\Support\ServiceProvider;

class MiniProgarm extends ServiceProvider
{
    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('WechatMiniPro', function(){
            return Factory::miniProgram([
                'app_id' => config('miniprogram.appid'),//wxd554e6eef059216c
                'secret' => config('miniprogram.appsecret'),//5113592c045e613d21384dd23228c139
                // 下面为可选项
                // 指定 API 调用返回结果的类型：array(default)/collection/object/raw/自定义类名
                'response_type' => 'array',

                'log' => [
                    'level' => 'debug',
                    'file' => __DIR__.'/wechat.log',
                ],
            ]);
        });

    }
}
